import { request } from "@utils/http";

export function getUserListRes(page: number, limit: number, username: string) {
    return request.get<any, any>("/admin/acl/user/" + `${page}/${limit}?username=${username}`)
}

export function addUserRes(data: any) {
    if (data.id) {
        return request.put("/admin/acl/user/update", data)
    } else {
        return request.post("/admin/acl/user/save", data)
    }
}

export function deleteUserRes(id: number | string) {
    return request.delete("/admin/acl/user/remove/" + id)
}

export function getUserRoleRes(id: string | number) {
    return request.get<any, any>("/admin/acl/user/toAssign/" + id)
}

export function setUserRoleRes(userId: string, roleId: string) {
    return request.post("/admin/acl/user/doAssign", {}, {
        params: {
            userId,
            roleId
        }
    })
}